﻿/* 
 * yaku
 * http://code.google.com/p/yaku/
 * 
 * Copyright 2011, Bryan McKelvey
 * Licensed under the MIT license
 * http://www.opensource.org/licenses/mit-license.php
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yaku
{
    public partial class KanjiDic2
    {
        /// <summary>
        /// Information on a kanji character.
        /// </summary>
        private class Kanji
        {
            private List<string> onyomiList = new List<string>();
            private List<string> kunyomiList = new List<string>();
            private List<string> meaningList = new List<string>();
            private List<string> nanoriList = new List<string>();

            /// <summary>
            /// Information on a kanji character.
            /// </summary>
            public Kanji()
            {
            }

            #region Properties
            /// <summary>
            /// The character itself in UTF8 coding.
            /// </summary>
            public string Literal { get; set; }

            /// <summary>
            /// The radical number, in the range 1 to 214. The particular
	        /// classification type is stated in the rad_type attribute.
            /// </summary>
            public int Radical { get; set; }

            /// <summary>
            /// The kanji grade level. 1 through 6 indicates a Kyōiku kanji
	        /// and the grade in which the kanji is taught in Japanese schools. 
            /// 8 indicates it is one of the remaining Jōyō Kanji to be learned 
            /// in junior high school, and 9 or 10 indicates it is a Jinmeiyō (for use 
            /// in names) kanji.
            /// </summary>
            public int GradeLevel { get; set; }

            /// <summary>
            /// The stroke count of the kanji, including the radical. If more than  one, the first is considered the accepted count, while subsequent ones are common miscounts.
            /// </summary>
            public int StrokeCount { get; set; }

            /// <summary>
            /// A frequency-of-use ranking. The 2,500 most-used characters have a
            /// ranking; those characters that lack this field are not ranked. The
            /// frequency is a number from 1 to 2,500 that expresses the relative
            /// frequency of occurrence of a character in modern Japanese. This is
            /// based on a survey in newspapers, so it is biassed towards kanji
            /// used in newspaper articles. The discrimination between the less
            /// frequently used kanji is not strong.
            /// </summary>
            public int? Frequency { get; set; }

            /// <summary>
            /// Japanese Language Proficiency test level for this kanji. Values
	        /// range from 1 (most advanced) to 4 (most elementary). This field 
	        /// does not appear for kanji that are not required for any JLPT level.
            /// </summary>
            public int JLPT { get; set; }

            /// <summary>
            /// Halpern's SKIP (System of Kanji Indexing by Patterns) code. The format is n-nn-nn.
            /// </summary>
            public int[] SkipCode { get; set; }

            /// <summary>
            /// The "on" Japanese reading of the kanji, in katakana, as a string.
            /// </summary>
            public string Onyomi
            {
                get { return string.Join("、", onyomiList); }
            }

            /// <summary>
            /// The "on" Japanese reading of the kanji, in katakana, as a list for adding new items.
            /// </summary>
            public List<string> OnyomiList
            {
                get { return onyomiList; }
                set { onyomiList = value; }
            }

            /// <summary>
            /// The "kun" Japanese reading of the kanji, usually in hiragana, as a string.
            /// </summary>
            public string Kunyomi
            {
                get { return string.Join("、", kunyomiList); }
            }

            /// <summary>
            /// The "kun" Japanese reading of the kanji, usually in hiragana, as a list for adding new items.
            /// </summary>
            public List<string> KunyomiList
            {
                get { return kunyomiList; }
                set { kunyomiList = value; }
            }

            /// <summary>
            /// The meaning associated with the kanji, as a string.
            /// </summary>
            public string Meaning
            {
                get { return string.Join(", ", meaningList); }
            }

            /// <summary>
            /// The meaning associated with the kanji, as a list for adding new items.
            /// </summary>
            public List<string> MeaningList
            {
                get { return meaningList; }
                set { meaningList = value; }
            }

            /// <summary>
            /// Japanese readings that are now only associated with names, as a string.
            /// </summary>
            public string Nanori
            {
                get { return string.Join("、", nanoriList); }
            }

            /// <summary>
            /// Japanese readings that are now only associated with names, as a list for adding new items.
            /// </summary>
            public List<string> NanoriList
            {
                get { return nanoriList; }
                set { nanoriList = value; }
            }
            #endregion
        }
    }
}
